<template>
  <div class="city-content">
    <div class="city-banner">
      <img src="/img/recommend1.png" alt="泸州城市banner" class="banner-img">
      <div class="city-info">
        <h1>泸州</h1>
        <p>川南重要港口城市、历史文化名城</p>
      </div>
    </div>
    
    <div class="city-section">
      <div class="section-title">热门景点</div>
      <div class="card-list">
        <div class="card-item" v-for="(item, index) in attractions" :key="'attr-'+index">
          <div class="card-image">
            <img :src="item.image" alt="景点图片">
          </div>
          <div class="card-title">{{item.name}}</div>
          <div class="card-desc">{{item.desc}}</div>
        </div>
      </div>
    </div>
    
    <div class="city-section">
      <div class="section-title">美食推荐</div>
      <div class="card-list">
        <div class="card-item" v-for="(item, index) in foods" :key="'food-'+index">
          <div class="card-image">
            <img :src="item.image" alt="美食图片">
          </div>
          <div class="card-title">{{item.name}}</div>
          <div class="card-desc">{{item.desc}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CityContent',
  props: {
    attractions: {
      type: Array,
      default: () => []
    },
    foods: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style scoped lang="less">
.city-content {
  padding-bottom: 20px;
  
  .city-banner {
    position: relative;
    height: 200px;
    overflow: hidden;
    
    .banner-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    
    .city-info {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 20px 15px;
      background: linear-gradient(transparent, rgba(0,0,0,0.7));
      color: #fff;
      
      h1 {
        font-size: 24px;
        margin-bottom: 5px;
      }
      
      p {
        font-size: 14px;
        opacity: 0.9;
      }
    }
  }
  
  .city-section {
    margin-top: 20px;
    padding: 0 15px;
    
    .section-title {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 15px;
    }
    
    .card-list {
      display: flex;
      overflow-x: auto;
      padding-bottom: 10px;
      
      .card-item {
        flex: 0 0 140px;
        margin-right: 10px;
        
        .card-image {
          height: 100px;
          border-radius: 8px;
          overflow: hidden;
          margin-bottom: 8px;
          
          img {
            width: 100%;
            height: 100%;
            object-fit: cover;
          }
        }
        
        .card-title {
          font-size: 14px;
          font-weight: bold;
          margin-bottom: 4px;
        }
        
        .card-desc {
          font-size: 12px;
          color: #666;
          line-height: 1.3;
        }
      }
    }
  }
}
</style> 